
<iframe srcdoc id="frame"></iframe>

<script>
  const doc = document.getElementById('frame').contentDocument;
  doc.open();
  doc.write("<h1>Hello world!</h1>");
  doc.close();
</script>
